import java.util.ArrayList;
import java.util.Scanner;
public class MainTwo {
    public static void main(String[] args){
        ArrayList<student> list = new ArrayList<student>();
        student s1 = new student("gxnu001","张三",18);
        student s2 = new student("gxnu002","李华",17);
        student s3 = new student("gxnu003","小明",12);
        list.add(s1);
        list.add(s2);
        list.add(s3);
        System.out.println("请输入要咨询的id");
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        int num = check1(list,str);
        boolean flag = check2(list,str);
        System.out.println(flag + " " +  num);
    }
    public static int check1(ArrayList<student> list,String id){
        for(int i = 0;i < list.size();i++){
            if(id.equals(list.get(i).getId())){
                return i;
            }
        }
        return -1;
    }
    public static boolean check2(ArrayList<student> list,String id){
        return check1(list,id) >= 0;
    }
}
